package com.foosun.core.entity;

import java.util.LinkedHashMap;
import java.util.Map;

import com.foosun.core.entity.Role;

import com.foosun.core.base.BaseEntity;
import com.foosun.core.util.JDBCName;

/**
 * 系统用户表
 *
 * @author xi
 */
@JDBCName("T_USER")
public class User extends BaseEntity {

	/*
     * 用户角色，日后可根据需要以表的形式存储
	 */
    /**
     * 管理员角色
     */
    public static final int ROLE_ADMIN = 0;
    /**
     * 老师角色
     */
    public static final int ROLE_TEACHER = 1;
    /**
     * 学生角色
     */
    public static final int ROLE_STUDENT = 2;
    /**
     * 默认密码*
     */
    public static final String DEFAULT_PASSWORD = "1";
    public static final Long DEFAULT_SIZE = 50 * 1024 * 1024L;


    private static final long serialVersionUID = 20140401;
    private String nickName;
    private String userName;
    private String password;
    private String memo;
    private Integer role;
    private Long skyDriveSize = DEFAULT_SIZE;
    private Long usedSize;

    private Boolean enable;


    private Role roleData;
    private LinkedHashMap<String, Object> resources;

    @Override
    public Map<String, Object> getEntityMap() {
        Map<String, Object> em = super.getEntityMap();
        em.put("user_name", userName);
        em.put("password", password);
        em.put("memo", memo);
        em.put("role", role);
        em.put("nick_name", nickName);
        em.put("sky_drive_size", skyDriveSize);
        em.put("used_size", usedSize);
        em.put("enable", enable);
        return em;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public Long getSkyDriveSize() {
        return skyDriveSize == null ? DEFAULT_SIZE : skyDriveSize;
    }

    public Role getRoleData() {
        return roleData;
    }

    public void setRoleData(Role roleData) {
        this.roleData = roleData;
    }

    public void setSkyDriveSize(Long skyDriveSize) {
        this.skyDriveSize = skyDriveSize;
    }

    public Long getUsedSize() {
        return usedSize;
    }

    public void setUsedSize(Long usedSize) {
        this.usedSize = usedSize;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public LinkedHashMap<String, Object> getResources() {
        return resources;
    }

    public void setResources(LinkedHashMap<String, Object> resources) {
        this.resources = resources;
    }
}
